package com.mfl.mapper;

import com.github.pagehelper.Page;
import com.mfl.pojo.dto.KYCourseBookPageQueryDTO;
import com.mfl.pojo.entity.KYCourseBook;
import com.mfl.pojo.vo.KYCourseBookPageQueryVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface KYCourseBookMapper {
    /**
     * 分页查询课程书籍
     * @param kyCourseBookPageQueryDTO
     * @return
     */
    Page<KYCourseBookPageQueryVO> queryByPage(KYCourseBookPageQueryDTO kyCourseBookPageQueryDTO);

    /**
     * 根据书籍名称查询课程书籍
     * @param bookName
     * @return
     */
    @Select("select * from ky_course_book where book_name = #{bookName}")
    KYCourseBook getBySourceName(String bookName);

    /**
     * 添加课程书籍
     * @param build
     */
    void insert(KYCourseBook build);

    /**
     * 批量删除课程书籍
     * @param ids
     */
    void deleteByIds(List<Integer> ids);

    /**
     * 根据id查询课程书籍
     * @param id
     * @return
     */
    @Select("select * from ky_course_book where id = #{id}")
    KYCourseBook getCourseBookById(int id);

    /**
     * 修改课程书籍
     * @param kyCourseBook
     */
    void update(KYCourseBook kyCourseBook);
}
